
package com.ruoyi.busi.guide.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.busi.guide.domain.Education;
import com.ruoyi.busi.guide.service.IEducationService;

/**
 * 教育经历Controller
 */
@RestController
@RequestMapping("/busi/guide/education")
public class EducationController extends BaseController {
    @Autowired
    private IEducationService educationService;

    /**
     * 根据导师ID获取教育经历列表
     */
    @GetMapping("/mentor/{mentorId}")
    public R listByMentorId(@PathVariable Long mentorId) {
        return R.ok(educationService.selectByMentorId(mentorId));
    }

    /**
     * 根据学校名称查询教育经历
     */
    @GetMapping("/school")
    public R listBySchool(@RequestParam String school) {
        return R.ok(educationService.selectBySchool(school));
    }

    /**
     * 新增教育经历
     */
    @PostMapping
    public R add(@RequestBody Education education) {
        return R.ok(educationService.save(education));
    }

    /**
     * 修改教育经历
     */
    @PutMapping
    public R edit(@RequestBody Education education) {
        return R.ok(educationService.updateById(education));
    }

    /**
     * 删除教育经历
     */
    @DeleteMapping("/{educationIds}")
    public R remove(@PathVariable List<Long> educationIds) {
        return R.ok(educationService.deleteEducationByIds(educationIds));
    }
}
